
// 天翼云工单查询
export const queryVms = function (params, data) {
  return this.$http({
    url: 'api/v1/searcher/vms',
    method: 'post',
    params: params,
    data
  })
}

// 云主机关机
export const shutdown = function (id) {
  return this.$http({
    url: `api/v1/vm/${id}/shutdown`,
    method: 'post',
    data: { a: 1 }
  })
}

// 云主机开机
export const startup = function (id) {
  return this.$http({
    url: `api/v1/vm/${id}/startup`,
    method: 'post',
    data: { a: 1 }
  })
}

// 重置os
export const restos = function (id) {
  return this.$http({
    url: `api/v1/vm/${id}/rest_os`,
    method: 'post'
  })
}

// 主机详情

export const detail = function (id) {
  return this.$http({
    url: `api/v1/ctyun/vm/${id}/detail`,
    method: 'get'
  })
}

// 基本详情
export const baseinfo = function (id) {
  return this.$http({
    url: `api/v1/ctyun/vm/${id}/basic`,
    method: 'get'
  })
}

// 主机导出

export const exportVm = id => `api/v1/ctyun/vm/${id}/export`

export const specialcloud = function (type, url, data, params) {
  return this.$http[type]('api/v1' + url, data || { params: params })
}

// 主机查询状态
export const fetchPowerState = function (data) {
  return this.$http({
    url: `api/v1/vm/getPowerState`,
    method: 'post',
    data
  })
}
